package com.isesol.controller;

import com.isesol.model.*;
import com.isesol.service.*;
import com.isesol.service.impl.UserServiceImpl;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.*;
import java.util.*;

@Controller
public class UserController {

    private Logger logger = Logger.getLogger(UserController.class);

    @Resource
    private IUserService userService;

    @RequestMapping("/showInfo/{userId}")
    @ResponseBody
    public Object showUserInfo(@PathVariable int userId){

        UserInfo userInfo = userService.getUserById(userId);
        return userInfo;
    }

    @RequestMapping("/showInfos")
    @ResponseBody
    public Object showUserInfos(){

        List<UserInfo> userInfos = userService.getUsers();
        return userInfos;
    }
}
